//
//  MyCLController.h
//  Hermes
//
//  Created by Martin Verzilli on 9/24/08.
//  Copyright 2008 Manas Technology Solutions SRL. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

#define GOODDISTANCE 50
#define BADDISTANCE 200
#define MAXREPEATS 3

// This protocol is used to send the text for location updates back to another view controller
@protocol MyCLControllerDelegate <NSObject>
@required
-(void)locationUpdate:(CLLocation *)location;
-(void)locationError:(NSString *)text;
@end

// provides geographic coordinates to its users
@interface MyCLController : NSObject <CLLocationManagerDelegate> {
	CLLocationManager *locationManager;
	CLLocation* currentLocation;
	
	id<MyCLControllerDelegate> delegate;
	
}

@property (nonatomic, retain) CLLocationManager *locationManager;
@property (nonatomic, retain) CLLocation* currentLocation;

- (id) initWithDelegate: (id<MyCLControllerDelegate>) dlg;

- (void)locationManager:(CLLocationManager *)manager
	didUpdateToLocation:(CLLocation *)newLocation
		   fromLocation:(CLLocation *)oldLocation;

- (void)locationManager:(CLLocationManager *)manager
	   didFailWithError:(NSError *)error;

//This class senses the location just once each time this method is called. 
- (void) refreshLocationWaiting:(NSTimeInterval) seconds;

- (void) fireError:(NSString*)msg;
@end
